package stream;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

/**
 * @Author com.alibaba.lizhen
 * @Date 2021/3/24 8:48 下午
 * @Version 1.0
 * @Description
 */
public class ParallelStreamTest {

    @Test
    public void test(){
        // 并行流 多个线程执行
        List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
        numbers.parallelStream()
                .forEach(System.out::print);

        //
        System.out.println("=========================");
        numbers.stream()
                .sequential()
                .forEach(System.out::print);
    }
}
